<template>
  <div>
    <Table :columns="columns" class="marginB20" :data="list" stripe border width="1000"></Table>
    <Box1 ref="Box1" :goods_type="goods_type"/>


    <Modal
      v-model="showBox"
      :footer-hide="true"
      :mask-closable="false"
      :width="840"
      class-name="vertical-center-modal"
      title="以补正形式答复"
    >
      <bzOaAuto ref="BzOaAuto" />
    </Modal>

    <Modal
      v-model="boxShow"
      :footer-hide="true"
      :mask-closable="false"
      :width="840"
      class-name="vertical-center-modal"
      @on-visible-change="vPchange"
      title="以OA形式答复"
    > 
      <div style="margin:-16px;max-height:500px;overflow-x:hidden;overflow-y:auto;">
        <OAone ref="OAone" />
      </div>
      
    </Modal>


    <Modal
      v-model="fuJShow"
      :footer-hide="true"
      :mask-closable="false"
      :width="840"
      class-name="vertical-center-modal"
      title="附件（点击下载）"
      @on-visible-change="vJchange"
    > 
      <template v-if="$app.judgeData(fuJianObj)">
        <div style="margin:-16px;max-height:500px;overflow-x:hidden;overflow-y:auto;">
          <div class="paddingLi">
            <div>
              
              <template v-if="$app.getVal_fileUrl(fuJianObj.appe_brief_desc_path)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.appe_brief_desc_path))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.appe_brief_desc_path)"></i>外观简要说明
                </span>
              </template>

              <!-- 新数据结构，理论上不会有这个，仅仅为了兼容老数据 -->
              <template v-if="$app.getVal_fileUrl(fuJianObj.appe_request_path)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.appe_request_path))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.appe_request_path)"></i>外观专利请求书
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.instruction)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.instruction))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.instruction)"></i>说明书
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.instruction_abstract)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.instruction_abstract))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.instruction_abstract)"></i>说明书摘要
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.claims)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.claims))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.claims)"></i>权利要求书
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.instruction_image)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.instruction_image))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.instruction_image)"></i>说明书附图
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.abstract_image)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.abstract_image))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.abstract_image)"></i>摘要附图
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.apply_path)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.apply_path))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.apply_path)"></i>{{goods_type_name()}}专利请求书
                </span>
              </template>

              <template v-if="$app.getVal_fileUrl(fuJianObj.bz_weituo)">
                <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(fuJianObj.bz_weituo))">
                  <i class="iconfont marginR5" :class="$app.fileIcon(fuJianObj.bz_weituo)"></i>代理委托书
                </span>
              </template>

              <template v-if="$app.judgeData(fuJianObj.compare_page_path)">
                <template v-for="(val,i) in (fuJianObj.compare_page_path)">
                  <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(val))">
                    <i class="iconfont marginR5" :class="$app.fileIcon(val)"></i>对照页{{(i+1)}}
                  </span>
                </template>
              </template>

              <template v-if="$app.judgeData(fuJianObj.other_paths)">
                <template v-for="(val,i) in (fuJianObj.other_paths)">
                  <span class="wnxZ textLine cBlue " @click="$app.openWindow($app.getVal_fileUrl(val))">
                    <i class="iconfont marginR5" :class="$app.fileIcon(val)"></i>其他文件{{(i+1)}}
                  </span>
                </template>
              </template>

              

              
              
            </div>
            <template v-if="$app.judgeData(fuJianObj.appe_img_list)">
              <div class="padding10" style="background-color:#f3f3f3;">
                <div class=" ">外观图片：</div>
                <template v-for="(val,i) in (fuJianObj.appe_img_list)">
                  <div style="width:80px;" class="inlineBlock marginR5 marginT10">
                    <img class="textLine contain inlineBlock   bgWhite" style="border:1px solid #eee;" :src="$app.getVal_fileUrl(val)" width="80" height="80" @click="$app.openWindow($app.getVal_fileUrl(val))">
                    <div class="txtOneLine textCenter f_12 c999">{{$app.urlToName(val)}}</div>
                  </div>
                </template>
              </div>
              
            </template>

            
          </div>
        </div>
      </template>
      
      
    </Modal>

    
  </div>
</template>

<style lang="less" scoped>
.wnxZ{
  width: 20%;
  display: inline-block;
  line-height: 2;
}
</style>

<script>
import Box1 from "./box/box1";
import BzOaAuto from "./box/bzOaAuto";
import OAone from './box/oAone';

//表格配置
import tabM from "@$@/js/$common/tabM";

export default {
  name: "tabM",
  components: {Box1,BzOaAuto,OAone},
  props: ["list","goods_type","orderInfo","orLiInfo"],//goods_type:100实用新型、101外观设计、102发明
  data() {
    let data = {

      columns: tabM.tabMcol(this),

      fuJianObj:{},//查看附件
    };
    let tool = {
      showBox:false, //补正
      boxShow:false,//OA
      fuJShow:false,//附件
    };
    return Object.assign(data, tool);
  },
  mounted() {},
  methods: {
    goods_type_name(){
      let{goods_type}=this;
      let out='';
      if(goods_type==100){
        out='实用新型';
      }else if(goods_type==101){
        out='外观设计';
      }else if(goods_type==102){
        out='发明';
      }
      return out;
    },
    // 补正框 赋值
    tow(arrList){
      //兼容老数据格式，不有一定都是
      let goList=[];
      arrList.forEach((val,i)=>{
        if($app.judgeData(val.cpcInfo) && $app.judgeData(val.cpcInfo[0].position)){
          goList.push(val)
        }
      });

      this.ogn_G(goList);
    },

    // 新的方式
    tow_Kk(arrList){
      this.ogn_G(arrList);
    },

    ogn_G(goList){
      this.$refs['BzOaAuto'].justSee=true;
      this.$refs['BzOaAuto'].buZList=goList;
      this.showBox=true;
    },

    // OA框 赋值
    iwR(html){
      this.$refs['OAone'].justSee=true;
      this.$refs['OAone'].html=html;
      this.boxShow=true;
    },

    //OA框 赋值
    vPchange(buEr){
      if(!buEr){//关闭窗口
        this.$refs['OAone'].clearHtml();
      }
    },
    vJchange(buEr){
      if(!buEr){//关闭窗口
        setTimeout(() => {
          this.fuJianObj={};//初始化附件
        }, 200);
      }
    },

    //附件大大查看
    kanFuJin(row){
      this.$set(this,'fuJianObj',row);
      this.fuJShow=true;
    }
  }
};
</script>

